package com.xl.utils.util.设计模式.工厂模式.工厂方法模式;

/**
 * @author xionglin
 * @date 2021/5/6 22:57
 * @Description ceshi
 */
public class Test {
    public static void main(String[] args) {
        //通过AppleFactory获取一个苹果
        FruitFactory appleFactory = new AppleFactory();
        Fruit fruit = appleFactory.getFruit();
        fruit.myName();

        //通过OrangeFactory获取一个苹果
        OrangeFactory orangeFactory = new OrangeFactory();
        Fruit fruit1 = orangeFactory.getFruit();
        fruit1.myName();
    }
}
